home *** CD-ROM | disk | FTP | other *** search
- Path: oasis.novia.net!not-for-mail
- From: nicatt@oasis.novia.net (Nicatt)
- Newsgroups: comp.lang.c
- Subject: Re: atof/atoi
- Date: 11 Feb 1996 15:12:09 GMT
- Organization: Novia Internetworking <> 28.8kbps dialup; 402/390-2NET
- Message-ID: <4fl109$31g@nntp.novia.net>
- References: <4fihpp$j5q@nntp.novia.net>
- NNTP-Posting-Host: oasis.novia.net
- X-Newsreader: TIN [UNIX 1.3 BETA-950824-color PL0]
-
- Nicatt (nicatt@oasis.novia.net) wrote:
-
- The question was answered by e-mail. Thank you. Perhaps I went
- thru the FAQ too quickly. I will look again but I didn't see it
- the first time thru.
- Nicatt
-
-
- :
- : I am a rookie.
- :
- : I have been through the faq and three C books and cannot find *how*
- : to use atof/atoi. Each mentions them and their purpose, but none explains
- : how to use them.
- :
- : I wrote a program that works fine. However, one of the requirements
- : is to trap for alpha characters. If I use "gets", my Y/N response
- : prior to the loop below falls through. I can define *catch* as a char
- : and trap the character after scanf (ex: catch=getchar(); ) but I have
- : not figured how to use that to my advantage to break the loop, reask for
- : the correct value to be entered, and restart the loop at that point.
- :
- : This is an internet class and the instructor said to use atof.
- :
- : The question is, how do you use atof?
- :
- : for(count=0; count<STUDENTS; count++)
- : { printf("\nWhat is student %i's grade average ", (count+1));
- : for(count2=0; count2<GRADES; count2++)
- : { printf("in class number %i?\n ", (count2+1));
- : scanf(" %f", &number);
- : grades[count][count2]=number;
- : printf("You entered %.3f \n\n", grades[count][count2]);
- : } }
- :
- : Thank you in advance for any assistance you may render.
- :
- : Bob
- : nicatt@oasis.novia.net
- :
-